{% extends 'user/base.html' %}

{% block title %}
    <title>编辑地址</title>
{% endblock %}

{% block content %}
<section class="slice pt-2 bg-surface-secondary">
    <div class="container mt-4 mb-5 pl-6  ">
        <div class="row">
            <div class="col col-md-3 mb-sm-4">
                <div class="col col-md12">
                    <div class="card-header pb-2 list-group-item-info">
                        个人信息
                    </div>
                    <ul class="list-group list-group-flush" id="myList">
                        <li class="list-group-item"><a href="{{ url_for('users.userInfo') }}" class="link-primary">个人资料</a></li>
                        <li class="list-group-item" style="background-color: #cefaff;"><a href="{{ url_for('address.address_management') }}" class="link-primary">地址管理</a></li>
                        <li class="list-group-item"><a href="{{ url_for('user.order_management') }}" class="link-primary">订单管理</a></li>
                        <li class="list-group-item">
                            <a href="{{ url_for('story.upload_story') }}" class="link-primary">上传故事管理</a>
                        </li>
                    </ul>
                    <div class="card-footer pb-2 list-group-item-info">
                        <p></p>
                    </div>
                </div>
            </div>
            <div class="col col-md-8 col-sm-12 ml-2 p-5 resume_box_body">
                <div class="container mt-4 mb-5">
        <h5 class="font-weight-bold border-bottom pb-2">编辑地址</h5>
        <form method="POST" action="{{ url_for('address.edit_address', address_id=address.id) }}">
            <div class="form-group">
                <label for="recipient_name">收件人姓名</label>
                <input type="text" class="form-control" name="recipient_name" value="{{ address.recipient_name }}" required>
            </div>
            <div class="form-group">
                <label for="phone">电话</label>
                <input type="text" class="form-control" name="phone" value="{{ address.phone }}" required>
            </div>
            <div class="form-group">
                <label for="address_line">地址</label>
                <input type="text" class="form-control" name="address_line" value="{{ address.address_line }}" required>
            </div>
            <div class="form-group form-check">
                <input type="checkbox" class="form-check-input" name="is_default" {% if address.is_default %}checked{% endif %}>
                <label class="form-check-label" for="is_default">设为默认地址</label>
            </div>
            <button type="submit" class="btn btn-primary">保存地址</button>
        </form>
    </div>
            </div>
        </div>
    </div>
</section>
{% endblock %} 